home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / FCntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  4.3 KB  |  142 lines  |  [TEXT/MPS ]

  1. /*
  2.  * FCntl.h -- faccess(), fcntl(), and open() mode flags
  3.  *
  4.  * Portions copyright American Telephone & Telegraph
  5.  * Used with permission, Apple Computer Inc. (1985,1988,1990,1992)
  6.  * All rights reserved.
  7.  */
  8.  
  9. #ifndef __FCNTL__
  10. #define __FCNTL__
  11.  
  12. #ifndef __TYPES__
  13. #include <Types.h>
  14. #endif
  15.  
  16. #ifndef __FILES__
  17. #include <Files.h>
  18. #endif
  19.  
  20. #ifndef __ALIASES__
  21. #include <Aliases.h>
  22. #endif
  23.  
  24. /*
  25.  *    For use by lseek():
  26.  */
  27.  
  28. #ifndef __STDIO__            /* these defns exactly paralled in StdIO.h for fseek() */
  29. #define SEEK_CUR    1
  30. #define SEEK_END    2
  31. #define SEEK_SET    0
  32. #endif
  33.  
  34. /*
  35.  * faccess() commands; for general use
  36.  */
  37.                      /* 'd' => "directory" ops */
  38. #define F_DELETE        (('d'<<8)|0x01)
  39. #define F_RENAME        (('d'<<8)|0x02)
  40.  
  41. /*
  42.  * more faccess() commands; for use only by MPW tools
  43.  */
  44.  
  45. #define F_OPEN             (('d'<<8)|0x00)        /* reserved for operating system use */
  46.                     /* 'e' => "editor" ops */
  47. #define F_GTABINFO         (('e'<<8)|0x00)        /* get tab offset for file */    
  48. #define F_STABINFO         (('e'<<8)|0x01)        /* set     "    "        "    "  */
  49. #define F_GFONTINFO        (('e'<<8)|0x02)        /* get font number and size for file */
  50. #define F_SFONTINFO        (('e'<<8)|0x03)        /* set     "        "    "    "    "    "      */
  51. #define F_GPRINTREC        (('e'<<8)|0x04)        /* get print record for file */
  52. #define F_SPRINTREC        (('e'<<8)|0x05)        /* set     "        "    "    "      */
  53. #define F_GSELINFO         (('e'<<8)|0x06)        /* get selection information for file */
  54. #define F_SSELINFO         (('e'<<8)|0x07)        /* set        "        "        "        " */
  55. #define F_GWININFO         (('e'<<8)|0x08)        /* get current window position */
  56. #define F_SWININFO         (('e'<<8)|0x09)        /* set    "        "        "        */
  57. #define F_GSCROLLINFO    (('e'<<8)|0x0A)        /* get scroll information */
  58. #define F_SSCROLLINFO    (('e'<<8)|0x0B)        /* set    "           "        */
  59. #define F_GMARKER        (('e'<<8)|0x0D)        /* Get Marker */
  60. #define F_SMARKER        (('e'<<8)|0x0C)        /* Set   "       */
  61. #define F_GSAVEONCLOSE    (('e'<<8)|0x0F)        /* Get Save on close */
  62. #define F_SSAVEONCLOSE    (('e'<<8)|0x0E)        /* Set   "     "     "      */
  63.  
  64. /*
  65.  *    argument structures used by various faccess() commands
  66.  */
  67.  
  68. struct MarkElement {
  69.     int                start;            /* start position of mark */
  70.     int                end;            /* end position */
  71.     unsigned char    charCount;        /* number of chars in mark name */
  72.     char            name[64];        /* mark name */
  73. } ;                                    /* note: marker names may be up to 64 characters long */
  74.  
  75. #ifndef __cplusplus
  76. typedef struct MarkElement MarkElement;
  77. #endif
  78.  
  79. struct SelectionRecord {
  80.     long    startingPos;
  81.     long    endingPos;
  82.     long    displayTop;
  83. };
  84.  
  85. #ifndef __cplusplus
  86. typedef struct SelectionRecord SelectionRecord;
  87. #endif
  88.  
  89.  
  90. /*
  91.  * Mode values accessible to open()
  92.  */
  93. #define O_RDONLY         0         /* Bits 0 and 1 are used internally */
  94. #define O_WRONLY         1         /* Values 0..2 are historical */
  95. #define O_RDWR              2        /* NOTE: it goes 0, 1, 2, *!* 8, 16, 32, ... */
  96. #define O_APPEND    (1<< 3)        /* append (writes guaranteed at the end) */
  97. #define O_RSRC         (1<< 4)        /* Open the resource fork */
  98. #define O_ALIAS        (1<< 5)        /* Open alias file */
  99. #define O_CREAT        (1<< 8)        /* Open with file create */
  100. #define O_TRUNC        (1<< 9)        /* Open with truncation */
  101. #define O_EXCL         (1<<10)     /* w/ O_CREAT:  Exclusive "create-only" */
  102. #define O_BINARY    (1<<11)     /* Open as a binary stream */
  103. #define O_NRESOLVE    (1<<14)        /* Don't resolve any aliases */
  104.  
  105. #ifdef __cplusplus
  106. extern "C" {
  107. #endif
  108.  
  109. /*
  110.  *        function prototypes
  111.  */
  112. int  close(int);
  113. int  creat(const char*);
  114. int     dup(int filedes);        /* OBSOLETE: fcntl(filedes, F_DUPFD, 0) is preferred */
  115. int     faccess(char*, unsigned int, long*);
  116. int  fcntl(int, unsigned int, int);
  117. long lseek(int, long, int);
  118. int  open(const char*, int);
  119. int  read(int, char*, unsigned);
  120. int  unlink(char*);
  121. int  write(int, const char*, unsigned);
  122. OSErr ResolveFolderAliases (
  123.     /* Info in  */    short volume, long directory, Str255 path, Boolean resolveLeafAlias,
  124.     /* Info out */    FSSpec *theSpec, Boolean *isFolder, Boolean *hadAlias, Boolean *leafIsAlias);
  125. OSErr MakeResolvedFSSpec (short volume, long directory, Str255 path,
  126.                           FSSpec *theSpec, Boolean *isFolder, Boolean *hadAlias,
  127.                           Boolean *leafIsAlias);
  128. OSErr ResolvePath (char *rawPath, char *resolvedPath, Boolean *isFolder, Boolean *hadAlias);
  129. OSErr MakeResolvedPath (short volume, long directory, Str255 path, Boolean resolveLeafAlias,
  130.                         char *buffer, Boolean *isFolder, Boolean *hadAlias, Boolean *leafIsAlias);
  131.  
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135.  
  136. /*
  137.  * fcntl() commands
  138.  */
  139. #define F_DUPFD 0       /* Duplicate files (file descriptor) */
  140.  
  141. #endif __FCNTL__
  142.